package com.panda.topic.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.panda.sys.entity.User;
import com.panda.topic.entity.StudentTopic;
import com.panda.topic.service.TopicService;
import com.panda.utils.Pager;
import com.panda.utils.contantUtil;

@Controller
public class MyTopicController {
	 
	@Resource
	private TopicService topicService;
 
	@RequestMapping("/student/topic/list")
	public String list(){
		return "student/topic_list";
	}
 
	@RequestMapping("/student/topic/getlist")
	@ResponseBody
	public String getlist(Model model, HttpServletRequest request,Long offSet,Long pageSize,String name){
		User user = (User) request.getSession().getAttribute(contantUtil.SESSION_USER);
		Pager<StudentTopic> topics=topicService.findStudentTopic(offSet, pageSize,user.getId(), name);
		return JSON.toJSONString(topics);
	}
	 
}
